package src;

import java.util.Random;
import java.util.Scanner;

public class CD {
    private static int str ;

    public static String cd(int C) {
        Scanner scan = new Scanner(System.in);
        Random ran = new Random();

        {

            while (true) {


                int B = ran.nextInt(2);                //生成随机数0/1，随机挑选整数或分数运算

                IntNumber in1 = IntNumber.obj();               //整数运算
                IntNumber in2 = IntNumber.obj();
                src.Fraction score1 = src.Fraction.obj();              //分数运算
                Fraction score2 = Fraction.obj();
                if (B == 0) {
                    switch (C) {                                //整数加减乘除运算
                        case 0:
                            String num = in1.add(in2);
                            String num1 = "" + num;
                            int num3 = in1.jia(in2);
                            String num6 = "" + num3;
                            int n = scan.nextInt();

                            Judgement.judge(n == num3, num6);
                            return num1;
                        case 1:
                            num = in1.subtract(in2);
                            num1 = "" + num;
                            num3 = in1.jian(in2);
                            num6 = "" + num3;
                            n = scan.nextInt();

                            Judgement.judge(n == num3, num6);

                            return num1;
                        case 2:
                            num = in1.multiply(in2);
                            num1 = "" + num;
                            num3 = in1.chen(in2);
                            num6 = "" + num3;
                            n = scan.nextInt();
                            Judgement.judge(n == num3, num6);


                            return num1;
                        case 3:
                            num1 = in1.divide(score1);
                            String Q = scan.next();
                            Judgement.judge(Q.equals(num1), num1);
                            return num1;
                    }
                } else {
                    switch (C) {                                           //分数加减乘除运算
                        case 0:
                            String num2 = score1.add(score2);
                            String num1 = num2;
                            Fraction num3 = score1.jia(score2);
                            String num4 = num3.toString();
                            String s = scan.next();
                            Judgement.judge(s.equals(num4), num4);
                            return num1;
                        case 1:
                            num2 =score1.subtract(score2);
                            num1 = num2.toString();
                            num3 = score1.jian(score2);
                            num4 = num3.toString();

                            s = scan.next();
                            Judgement.judge(s.equals(num4), num4);
                            return num1;
                        case 2:
                            num2 = score1.multiply(score2);
                            num1 = num2.toString();
                            num3 = score1.chen(score2);
                            num4 = num3.toString();
                            s = scan.next();
                            Judgement.judge(s.equals(num4), num4);
                            return num1;
                        case 3:
                            num2 = score1.divide(score2);
                            num1 = num2.toString();

                            num3 = score1.chu(score2);
                            num4 = num3.toString();
                            s = scan.next();
                            Judgement.judge(s.equals(num4), num4);
                            return num1;
                    }
                }
            }
        }

    }

}